//
// Created by 77873 on 2020/7/16 0016.
//

#ifndef FFMPEGPROJECT_MINECALLJAVA_H
#define FFMPEGPROJECT_MINECALLJAVA_H

#include <cwchar>
#include "jni.h"
#include "AndroidLog.h"

#define  MAIN_THREAD 0
#define  CHILD_THREAD 1

class MineCallJava {


public:
    JavaVM *javaVM = NULL;

    JNIEnv *jniEnv = NULL;

    jobject jobj;

    jmethodID jmid_parpared;

    jmethodID jmid_load;

    jmethodID jmid_timeinfo;

    jmethodID jmid_error;

    jmethodID jmid_complete;

    jmethodID jmid_valumedb;

    jmethodID jmid_pcmtoaac;

    jmethodID jmid_pcminfo;

    jmethodID jmid_pcmrate;
    jmethodID jmid_renderYuv;
public:

    MineCallJava(JavaVM *vm, JNIEnv *evn, jobject *obj);

    ~MineCallJava();


    void onCallParpared(int type);

    void onCallLoad(int type, bool isLoad);

    void onCallTimeInfo(int type, int curr, int total);


    void onCallError(int type, int code, char *msg);

    void onComplete(int type);

    void onCallValumeDB(int type,int db);

    void OnCallPcmToAAC(int type,int size,void *buffer);

    void onPcmCallBack(void *buffer,int size);

    void onPcmRateCallBack(int sampleRate);

    void onCallRenderYuv(int width,int height,uint8_t *fy,uint8_t *fu,uint8_t *fv);
};


#endif //FFMPEGPROJECT_MINECALLJAVA_H
